#Generic code makefile
#nice, easy, and it works

IN = ECmain.cpp mta.cpp TrainStopData.cpp MTAfunctional.cpp
OUT = out
DB = dbg
STD = 0x

#Text Manips
ECHO = @echo #-e
RESET = "\033[0m"
RED = "\033[0;1;31m"
GREEN = "\033[0;1;32m"
YELLOW = "\033[0;1;33m"

.PHONY : run clean new debug build clear

run: $(OUT)
	$(ECHO) $(GREEN)
	$(ECHO)  Running
	-./$(OUT) 
	$(ECHO) $(RESET)

build: $(OUT)

$(OUT): $(IN)
	@clear
	$(ECHO) $(RED)
	$(ECHO) Compiling...
	g++ -Wall -std=c++$(STD) -o $(OUT) $(IN) || (echo $(RESET) && false)
	$(ECHO) $(RESET)

debug: $(DB)
	$(ECHO) $(YELLOW)
	gdb ./$(DB)
	$(ECHO) $(RESET)

$(DB): $(IN)
	@clear
	$(ECHO) $(YELLOW)
	$(ECHO) -e Compiling for Debug
	g++ -Wall -g -std=c++$(STD) -o $(DB) $(IN) || (echo $(RESET) && false)
	

new: clean run

clean: clear
	rm -f $(OUT) $(DB)

clear:
	$(ECHO) -e Cleaning
	$(ECHO) $(RESET)
	@clear
